package com.ssy.lingxi.purchase.api.enums.purchase;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 采购能力-采购询价单  工作流内部状态枚举
 *
 * @author wrc
 * @date 2021/1/19
 */
public enum PurchaseInquiryListInteriorWorkStateEnum {
    CANCEL(-1, "已作废"),
    STAY_SUBMIT(1, "待提交审核采购需求单"),
    STAY_EXAMINE1(2, "待审核采购需求单(一级)"),
    STAY_EXAMINE2(3, "待审核采购需求单(二级)"),
    STAY_SUBMIT_OFFER(4, "待提交采购需求单"),
    CONTRAST_PRICE(5, "已提交审核采购需求单"),
    SUBMIT_NOT_ADOPT1(8, "审核不通过(一级)"),
    SUBMIT_NOT_ADOPT2(9, "审核不通过(二级)"),

    //确认报价内部
    STAY_CONTRAST_PRICE(21, "待比价"),
    STAY_EXAMINE_AWARD_RESULTS1(22, "待审核授标结果(一级)"),
    STAY_EXAMINE_AWARD_RESULTS2(23, "待审核授标结果(二级)"),
    STAY_CONFIRM_AWARD_RESULTS(24, "待确认授标结果"),
    EXAMINE_AWARD_RESULTS1(25, "审核授标结果不通过(一级)"),
    EXAMINE_AWARD_RESULTS2(26, "审核授标结果不通过(二级)"),
    COMPLETE(99, "已完成"),
    ;
    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

    PurchaseInquiryListInteriorWorkStateEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        PurchaseInquiryListInteriorWorkStateEnum workEnum = Arrays.stream(PurchaseInquiryListInteriorWorkStateEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(PurchaseInquiryListInteriorWorkStateEnum.class, workEnum.getState());
    }
}
